﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using CCWin.SkinControl;

namespace GroupChat2013.Main.Controls
{
    public partial class AppPanel : SkinPanel
    {
        //横向坐标
        private int[] xList = new int[4] { 5, 53, 102, 151 };

        //高度间距
        private int yMargin = 11;

        ////横向坐标
        //private int[] xList = new int[3] { 8, 73, 137 };
        ////高度间距
        //private int yMargin = 15;

        public AppPanel()
        {
            InitializeComponent();

            for (int i = 0; i < 13; i++)
            {
                AddAppItem(new AppItem());
            }
        }

        /// <summary>
        /// 添加应用
        /// </summary>
        /// <param name="appItem"></param>
        public void AddAppItem(AppItem appItem)
        {
            this.Controls.Add(appItem);

            int x = xList[(this.Controls.Count - 1) % 4];

            int index = (this.Controls.Count - 1) / 4;
            int y = index == 0 ? yMargin : (appItem.Height + yMargin) * index + yMargin;
            appItem.Location = new Point(x, y);
            appItem.AppName = appItem.AppName + this.Controls.Count;
        }
    }
}
